package py.owner.log.util;

import py.owner.log.format.LogFormat;
import py.owner.log.format.ObjectJsonFormat;

public abstract class AbstractLogUtil {

    /**
     * logger格式化成 alert monitor 格式,如果是字符串,直接输出,是对象,输出JSON格式
     * @param title   the title
     * @param message the message
     * @return string string
     */
    public static String formatLog(String title, Object... message) {
        return formatLog(ObjectJsonFormat.title(title).obj(message));
    }

    /**
     * 格式化log
     * @param logFormat
     * @return
     */
    public static String formatLog(LogFormat logFormat) {
        return (logFormat != null) ? logFormat.log() : "";
    }
}
